<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <el-card class="box-card">
    <div class="photo">
      <!-- 上传图片 -->
      <h1>菜品详情</h1>
      <img :src="this.UserForm.url" alt="" />
    </div>
    <div class="FormMessage">
      <el-form
        :label-position="labelPosition"
        label-width="50px"
        :model="UserForm"
      >
        <el-form-item label="菜名">
          <el-input v-model="UserForm.name" disabled></el-input>
        </el-form-item>
        <el-form-item label="描述">
          <el-input v-model="UserForm.like" disabled></el-input>
        </el-form-item>
        <el-form-item label="价格">
          <el-input v-model="UserForm.price" disabled></el-input>
        </el-form-item>
        <el-button type="primary" @click="AddColloge">加入收藏</el-button>
        <el-button type="success" @click="AddYuding">预定</el-button>
      </el-form>
    </div>
  </el-card>
</template>
          
    <script>
export default {
  created() {},
  data() {
    return {
      labelPosition: "left",
      UserForm: {
        url: "https://picgo-photos.oss-cn-hangzhou.aliyuncs.com/img/src=http___lmg.jj20.com_up_allimg_1115_120R11I602_21120QI602-4-1200.jpg&refer=http___lmg.jj20.webp",
        name: "蓝色妖姬",
        like: "甜的，辣的",
        price: "书宜烧仙草，外婆食堂",
      },
    };
  },
  methods: {
    AddColloge() {
      this.$confirm("此操作将把菜品加入收藏, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: "true",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "收藏成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消收藏",
          });
        });
    },
    AddYuding() {
      this.$confirm("此操作将预定菜品, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: "true",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "预定成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消预定",
          });
        });
    },
  },
};
</script>
    
    <style scoped>
.photo {
  text-align: center;
  margin-bottom: 20px;
}
.photo img {
  width: 30%;
}
.FormMessage {
  text-align: center;
  width: 20%;
  margin: 0 auto;
  margin-top: 30px;
}
</style>
          